< previous page page_529 next page >

Page 529
appear, the splash screen is unloaded. The Application Wizard helps you set up the code for this to work, as follows:
Sub Main()
    frmSplash.Show
    frmSplash.Refresh
    Set fMainForm = New frmMain
    Load fMainForm
    Unload frmSplash

    fMainForm.Show

End Sub
Giving Windows a Chance
Another reason an application appears to slow down occurs when code routines that are processing large amounts of data don't have any commands that require calls to the Windows engine. This will cause users to think that the computer has frozen or locked up. Windows can't process any user input, such as mouse clicks, unless a Visual Basic control command or Windows call is executed. To prevent this from becoming obvious, you should execute a DoEvents statement within the intensive processing code. This statement passes control to the operating system. After the operating system finishes processing the events in its queue and all keys in the SendKeys queue are sent, control is returned to your application.
Caution
Even though the
DoEvents statement is an essential and useful tool to allow Windows to do some processing, it has been known to cause some unexpected problems to appear. You should use this statement carefully.

Distracting the User
Another way to prevent the perceived impression of a slow application is to display the status of a process (see Figure 19.2). As you saw on Day 1, however, by using a combination of progress bar, text box, and the new animation controls (see Figure 19.3), you can create a professional-looking status display that will do several things: tell users that something is definitely being processed and, in most cases, show users that the computer hasn't locked up.

 
< previous page page_529 next page >

If you like this book, buy it!